<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page contentType="text/html; charset=utf-8"%>
<%@page import="com.yc.comm.Constant"%>
<%
String path = request.getContextPath(); 
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String jspName = request.getRequestURI();
jspName = jspName.substring(jspName.lastIndexOf("/") + 1);
String strToPage = request.getParameter("ToPage");
String strbtsname = request.getParameter("btsname");
String strbtscode = request.getParameter("btscode");
String strsnid = (String) request.getAttribute("snid");
if(strsnid == null || strsnid.equals("null"))
	strsnid = "";	
%>
<html>  
  <head> 
    <base href="<%=basePath%>">    
    <link rel="stylesheet" type="text/css" href="<%=path%>/js/ext/resources/css/ext-all.css">  
	<link rel="stylesheet" type="text/css" href="<%=path%>/js/ext/resources/css/edit-grid.css">   
	<script type="text/javascript" src="<%=path%>/js/ext/adapter/ext/ext-base.js"></script>
	<script type="text/javascript" src="<%=path%>/js/ext/ext-all.js"></script>
	<script type="text/javascript" src="<%=path%>/js/ext/DWRTreeLoader.js"></script>
	<script type="text/javascript" src="<%=path%>/js/ext/SearchField.js"></script> 
	<script type="text/javascript" src="<%=path%>/js/ext/query-dwr-proxy.js"></script>	
	<script type='text/javascript' src="<%=path%>/dwr/interface/JMagnifierWeb.js"></script>
	<script type='text/javascript' src="<%=path%>/dwr/interface/JPowerBoxWeb.js"></script>
	<script type='text/javascript' src="<%=path%>/dwr/interface/JBTSWeb.js"></script>
	<script type='text/javascript' src="<%=path%>/dwr/interface/JCommWeb.js"></script>
	<script type='text/javascript' src="<%=path%>/dwr/interface/JGeographicalenvWeb.js"></script>
	<script type='text/javascript' src="<%=path%>/dwr/interface/JStorageBatteryWeb.js"></script>
	<script type='text/javascript' src="<%=path%>/dwr/interface/JAirconditionWeb.js"></script>
	<script type='text/javascript' src="<%=path%>/dwr/interface/JFireExtinGuisherWeb.js"></script>
	<script type='text/javascript' src="<%=path%>/dwr/interface/JBathunderWeb.js"></script>
	<script type='text/javascript' src="<%=path%>/dwr/interface/JEnvMontorWeb.js"></script>
	<script type='text/javascript' src="<%=path%>/dwr/interface/JDynamoWeb.js"></script>
	<script type='text/javascript' src="<%=path%>/dwr/interface/JTransformerWeb.js"></script>
	<script type='text/javascript' src="<%=path%>/dwr/interface/JMainssupplyWeb.js"></script>
	<script type='text/javascript' src="<%=path%>/dwr/interface/JIronTowerWeb.js"></script>
	<script type='text/javascript' src="<%=path%>/dwr/interface/JMachineRoomWeb.js"></script>
	<script type='text/javascript' src="<%=path%>/dwr/interface/JPowerSupplyWeb.js"></script>
	<script type='text/javascript' src="<%=path%>/dwr/interface/JTrafficInfoWeb.js"></script>
	<script type='text/javascript' src="<%=path%>/dwr/interface/JAcdcDistributionWeb.js"></script>
	<script type='text/javascript' src="<%=path%>/dwr/interface/JTransfersWeb.js"></script>
	<script type='text/javascript' src="<%=path%>/dwr/interface/JAntennaFeederWeb.js"></script>
	<script type='text/javascript' src="<%=path%>/dwr/engine.js"></script>
	<script type='text/javascript' src="<%=path%>/dwr/util.js"></script>	
	<script type="text/javascript" src="<%=path%>/pages/browse/station/LoadJs.js"></script>	 
	<script type="text/javascript" src="<%=path%>/pages/browse/station/Geographicalenv.js"></script>	 
	<!--
	<script type="text/javascript" src="<%=path%>/pages/browse/station/Magnifier.js"></script>	  
	<script type="text/javascript" src="<%=path%>/pages/browse/station/PowerBox.js"></script>	
	<script type="text/javascript" src="<%=path%>/pages/browse/station/BTS.js"></script>	
	
	<script type="text/javascript" src="<%=path%>/pages/browse/station/StorageBattery.js"></script>	
	<script type="text/javascript" src="<%=path%>/pages/browse/station/Aircondition.js"></script>	
	<script type="text/javascript" src="<%=path%>/pages/browse/station/FireExtinGuisher.js"></script>	
	<script type="text/javascript" src="<%=path%>/pages/browse/station/Bathunder.js"></script>
	<script type="text/javascript" src="<%=path%>/pages/browse/station/EnvMontor.js"></script>
	<script type="text/javascript" src="<%=path%>/pages/browse/station/Dynamo.js"></script>
	<script type="text/javascript" src="<%=path%>/pages/browse/station/Transformer.js"></script>
	<script type="text/javascript" src="<%=path%>/pages/browse/station/MainsSupply.js"></script>
	<script type="text/javascript" src="<%=path%>/pages/browse/station/Irontower.js"></script>
	<script type="text/javascript" src="<%=path%>/pages/browse/station/MachineRoom.js"></script>
	<script type="text/javascript" src="<%=path%>/pages/browse/station/PowerSupply.js"></script>
	<script type="text/javascript" src="<%=path%>/pages/browse/station/Trafficinfo.js"></script>	 
	-->
	
	<style type="text/css" media="all">   
	    .allow-float {clear:none!important;} /* 允许该元素浮动 */  
	    .stop-float {clear:both!important;} /* 阻止该元素浮动 */  
	   	.icon-first {float:left;}   
	   	.icon-choosed {float:left;padding:5 0 0 5px;}
	    .icon-second {float:left;padding:0 0 0 20px;} 
	    .win-first {float:left;}   
	    .win-second {float:left;padding:0 0 0 20px;}   
	   	.standby-yes {float:left;}   
	    .standby-no {float:left;padding:0 0 0 20px;}   
	    .age-field {float:left;padding:0 0 0 58px;*padding:0 0 0 50px!important;*padding:0 0 0 50px;}   
	</style> 
	
  </head>
<body> 
<div id="mainTabPanelDIV" style="width:100%;height:100%">
	<div id="GeographicalenvTab"/> 
	<div id="BTSTab"/> 
	<div id="TowerMountedTab"/>  
	<div id="PowerBoxTab"/>  
	<div id="BatteryTab"/> 
	<div id="AirconditionTab"/> 
	<div id="FireExtinGuisherTab"/> 
	<div id="BathundeTab"/> 
	<div id="EnvMontorTab"/> 
	<div id="DynamoTab"/> 
	<div id="AcdcdistributionTab"/>
	<div id="TransformerTab"/>
	<div id="TransfersTab"/> 
	<div id="MainssupplyTab"/>
	<div id="antennafeederTab"/> 
	<div id="irontowerTab"/>
	<div id="machineroomTab"/>
	<div id="powersupplyTab"/>  
	<div id="trafficinfoTab"/>
</div>
<script>

var dataTowerMounter = {'btscode':"<%=strbtscode%>",
											'btsname':"<%=strbtsname%>"
										  };	 		
var recordForAll = new Ext.data.Record(dataTowerMounter);
function loadDate(ds,form){
	ds.on('beforeload', function() 
	{
		ds.baseParams = {'<%=Constant.BTS_CODE%>':'<%=strbtscode%>'};
	});
	ds.load({params:{start:0,limit:17,'<%=Constant.BTS_CODE%>':'<%=strbtscode%>'}});			
	form.getForm().loadRecord(recordForAll);	
}

function loadBtsCodeDate(ds){
	ds.on('beforeload', function() 
	{
		ds.baseParams = {'<%=Constant.BTS_CODE%>':'<%=strbtscode%>'};
	});
	ds.load({params:{'<%=Constant.BTS_CODE%>':'<%=strbtscode%>'}});			
}

function loadTCdata(ds,transfer_id){
	ds.on('beforeload', function() 
	{
		ds.baseParams = {'<%=Constant.TRANSFER_ID%>':transfer_id};
	});
	ds.load({params:{start:0,limit:10,'<%=Constant.TRANSFER_ID%>':transfer_id}});		 
}

var recordTypeAir = '<%=Constant.ACDC_TYPE_FOR_AIRS%>';
var recordTypeEle = '<%=Constant.ACDC_TYPE_FOR_ELE%>';
var recordType;
function loadAirdata(ds,acdcid){
	ds.on('beforeload', function() 
	{
		ds.baseParams = {'<%=Constant.ACDC_ID%>':acdcid,'<%=Constant.ACDC_RECORD_TYPE%>':'<%=Constant.ACDC_TYPE_FOR_AIRS%>'};
	});
	ds.load({params:{start:0,limit:10,'<%=Constant.ACDC_ID%>':acdcid,'<%=Constant.ACDC_RECORD_TYPE%>':'<%=Constant.ACDC_TYPE_FOR_AIRS%>'}});		 
	recordType = recordTypeAir;
}	

function loadEledata(ds,acdcid){
	ds.on('beforeload', function() 
	{
		ds.baseParams = {'<%=Constant.ACDC_ID%>':acdcid,'<%=Constant.ACDC_RECORD_TYPE%>':'<%=Constant.ACDC_TYPE_FOR_ELE%>'};
	});
	ds.load({params:{start:0,limit:10,'<%=Constant.ACDC_ID%>':acdcid,'<%=Constant.ACDC_RECORD_TYPE%>':'<%=Constant.ACDC_TYPE_FOR_ELE%>'}});		 
	recordType = recordTypeEle;
}

function loadEleAndAirdata(ds,acdcid,type){
	ds.on('beforeload', function() 
	{
		ds.baseParams = {'<%=Constant.ACDC_ID%>':acdcid,'<%=Constant.ACDC_RECORD_TYPE%>':type};
	});
	ds.load({params:{start:0,limit:10,'<%=Constant.ACDC_ID%>':acdcid,'<%=Constant.ACDC_RECORD_TYPE%>':type}});		 
	recordType = type;
}


var btsFirstNo = "<%=strbtscode%>";

Ext.onReady(function(){ 
	Ext.QuickTips.init();	
	Ext.form.Field.prototype.msgTarget = 'side'; 
	var mainTabPanelDIV = Ext.get("mainTabPanelDIV");
	var tabPanel = new Ext.TabPanel({
        renderTo:'mainTabPanelDIV',
		resizeTabs:true, // turn on tab resizing
        minTabWidth: 90,
        tabWidth:135,
		enableTabScroll:1,
		height:530,
	    width:mainTabPanelDIV.getComputedWidth(),
        defaults:{autoHeight:true},
		items:[
	            {contentEl:'GeographicalenvTab',title: '地理环境',id:1},
	            {contentEl:'BTSTab',title: '无线设备',id:2},				
				{contentEl:'PowerBoxTab',title: '电源柜',id:3},
				{contentEl:'BatteryTab',title: '蓄电池',id:4},
				{contentEl:'TransfersTab',title: '传输',id:5},
				{contentEl:'AirconditionTab',title: '空调',id:6},
				{contentEl:'FireExtinGuisherTab',title: '灭火器',id:7},
				{contentEl:'BathundeTab',title: 'B级防雷器',id:8},
				{contentEl:'EnvMontorTab',title: '动环监控',id:9},
				{contentEl:'DynamoTab',title: '发电机组',id:10},
				{contentEl:'AcdcdistributionTab',title: '交直流配电',id:11},
				{contentEl:'TransformerTab',title: '变压器',id:12},			
				{contentEl:'MainssupplyTab',title: '市电引入',id:13}, 
				{contentEl:'antennafeederTab',title: '天馈',id:15},
				{contentEl:'irontowerTab',title: '铁塔',id:16},
				{contentEl:'machineroomTab',title: '机房',id:17},
				{contentEl:'powersupplyTab',title: '基础供电归属',id:18},
				{contentEl:'trafficinfoTab',title: '交通状况',id:19},
				{contentEl:'TowerMountedTab',title: '塔放',id:20}
        ]
    });
	 
	tabPanel.activate(1); 
	
	//初始化环境信息
	setTimeout(function(){
	 	JGeographicalenvWeb.getInfoByBtsCode("<%=strbtscode%>",function(obj) 
		{
			if(obj != null)
			{
				var data = {
							'btscode':obj.btscode,
							'btsname':obj.btsname,
							'btszone':obj.btszone,
							'landform':obj.landform,
							'lng':obj.lng,
							'lat':obj.lat,
							'relocationrd':obj.relocationrd,
							'username':obj.username,
							'distcode':obj.distcode,
							'btslevel':obj.btslevel,
							'workingradius':obj.workingradius,
							'memo':obj.memo,
							'graphDeatilAddr':obj.graphDeatilAddr,
							'graphHigh':obj.graphHigh,
							'trannetid':obj.trannetid,
							'trannetname':obj.trannetname,
							'trannetgrade':obj.trannetgrade,
							'registtime':obj.registtime,
							'btskind':obj.btskind,
							'btstype':obj.btstype,
							'coverage':obj.coverage,
							'maintype':obj.maintype
							
						   }; 
				var record = new Ext.data.Record(data);		    	     	    
				geographicalenvPanel.getForm().loadRecord(record);			   
			}
		})
	 },1500);
	

	var dataTowerMounter = {'btscode':"<%=strbtscode%>",
											'btsname':"<%=strbtsname%>",
											'num':"1",
											'capacity':"1"
										  };	 		
	var recordForAll = new Ext.data.Record(dataTowerMounter);
	//geographicalenvPanel.getForm().loadRecord(recordForAll);	
	
	tabPanel.on('tabchange',function()
	{ 		
		var selectedID = tabPanel.getActiveTab().id;
		switch(selectedID)
	    {
			case 1: 	
				
				break
			case 2:
				//2.bts 读取数据				 
				loadJs("<%=path%>/pages/browse/station/BTSNEW.js");	
				break				
			case 3: 
				//4.电源柜 读取数据  	
				loadJs("<%=path%>/pages/browse/station/PowerBox.js");	
				break;
			case 4: 
				//4.蓄电池 读取数据  
				loadJs("<%=path%>/pages/browse/station/StorageBattery.js");					
				break;	
			case 5: 
				//4.传输 读取数据 
				loadJs("<%=path%>/pages/browse/station/Transfers.js");					
				break;	
			case 6: 
				//4.空调 读取数据  	
				loadJs("<%=path%>/pages/browse/station/Aircondition.js");
				break;	
			case 7: 
				//4.灭火器 读取数据  
				loadJs("<%=path%>/pages/browse/station/FireExtinGuisher.js");
				break;
			case 8: 
				//4.B级防雷器 读取数据				  
				loadJs("<%=path%>/pages/browse/station/Bathunder.js");
				break;	
			case 9: 
				//4.动环监控 读取数据 
				loadJs("<%=path%>/pages/browse/station/EnvMontor.js");				
				break;	
			case 10: 
				//4.动环监控 读取数据 		
				loadJs("<%=path%>/pages/browse/station/Dynamo.js");					
				break;	
			case 11: 
				// 交直流配电 读取数据
				loadJs("<%=path%>/pages/browse/station/Acdcdistribution.js"); 				
				break;	
			case 12: 
				//4.动环监控 读取数据 	
				loadJs("<%=path%>/pages/browse/station/Transformer.js");					
				break;	
				
			case 13: 
				//市电引入 读取数据 
				loadJs("<%=path%>/pages/browse/station/MainsSupply.js");					
				break;	
			case 15: 
				//天馈 读取数据
				loadJs("<%=path%>/pages/browse/station/AntennaFeeder.js");				
				break;	
			case 16: 
				//铁塔 读取数据
				loadJs("<%=path%>/pages/browse/station/Irontower.js");			
				break;		 
			case 17: 
				//机房 读取数据
				loadJs("<%=path%>/pages/browse/station/MachineRoom.js");				
				break;		
			case 18: 
				//基础供电归属 读取数据
				loadJs("<%=path%>/pages/browse/station/PowerSupply.js");			
				break;		
			case 19:   
				//交通状况 读取数据 	
				loadJs("<%=path%>/pages/browse/station/Trafficinfo.js");				
				break;					
			case 20:
				//20.塔放 读取数据		
				loadJs("<%=path%>/pages/browse/station/Magnifier.js");	 
				break
		  
	    }  
		  
		

		
	})
	
	 
	
 

	
}) 





/**
*地理环境js
*/

var geographicalenvPanel;

Ext.onReady(function(){  
	Ext.QuickTips.init();
	Ext.form.Field.prototype.msgTarget = 'side';
	
	
	var btszoneStore  = new Ext.data.Store({  
		        proxy:new Ext.data.DWRProxy(JCommWeb.getDirctoryByType,{}),  
		        reader:new Ext.data.DWRArrayReader(
						{},
						new Ext.data.Record.create([  
							{name: 'text', mapping:1},       
							{name: 'value',mapping:0}                   
						  ])
						)  
		    }); 
	
	var btszoneCombo = new Ext.form.ComboBox({	   
		fieldLabel: '基站位置区域',
		name: 'btszone',	
		width:200,
		valueField :"value",
	    displayField: "text",
	    mode: 'remote',
		selectOnFocus:true,                    
		forceSelection: true,
		blankText:'请选基站位置区域',
		emptyText:'选择基站位置区域',
		hiddenName:'btszone',
		triggerAction: 'all',
		allowBlank:false,
		editable:false, 
		disabled:true,
		store: btszoneStore
	});
	btszoneStore.on('beforeload', function() {
			  btszoneStore.baseParams = {
					DIRECTORY_TYPE:'01'   
			  };
		});	
	btszoneStore.load({params:{DIRECTORY_TYPE:'01'}});
	
	
	var landformStore  = new Ext.data.Store({  
		        proxy:new Ext.data.DWRProxy(JCommWeb.getDirctoryByType,{}),  
		        reader:new Ext.data.DWRArrayReader(
						{},
						new Ext.data.Record.create([  
							{name: 'text', mapping:1},       
							{name: 'value',mapping:0}                   
						  ])
						)  
		    }); 
	
	var landformCombo = new Ext.form.ComboBox({	   
		fieldLabel: '基站地形',
		name: 'landform',	
		width:200,
		valueField :"value",
	    displayField: "text",
	    mode: 'remote',
		selectOnFocus:true,                    
		forceSelection: true,
		disabled:true,
		blankText:'请选基站地形',
		emptyText:'选择基站地形',
		hiddenName:'landform',
		triggerAction: 'all',
		allowBlank:false,
		editable:false, 
		store: landformStore
	});
	landformStore.on('beforeload', function() {
			  landformStore.baseParams = {
					DIRECTORY_TYPE:'02'   
			  };
		});	
	landformStore.load({params:{DIRECTORY_TYPE:'02'}});
	
	
	var distcodeStore  = new Ext.data.Store({  
		        proxy:new Ext.data.DWRProxy(JCommWeb.scdqxslist,{}),  
		        reader:new Ext.data.DWRArrayReader(
						{},
						new Ext.data.Record.create([  
							{name: 'text', mapping:1},       
							{name: 'value',mapping:0}                   
						  ])
						)  
		    }); 
	var distcodeCombo = new Ext.form.ComboBox({	   
		fieldLabel: '所属地区',
		name: 'distcode',	
		width:200,
		valueField :"value",
	    displayField: "text",
	    mode: 'remote',
		selectOnFocus:true,                    
		forceSelection: true,
		disabled:true,
		blankText:'请选所属地区',
		emptyText:'选择所属地区',
		hiddenName:'distcode',
		triggerAction: 'all',
		allowBlank:false,
		editable:true, 
		store: distcodeStore
	});
	distcodeStore.load({});
	
	var btslevelStore = new Ext.data.Store({  
		        proxy:new Ext.data.DWRProxy(JCommWeb.getDirctoryByType,{}),  
		        reader:new Ext.data.DWRArrayReader(
						{},
						new Ext.data.Record.create([  
							{name: 'text', mapping:1},       
							{name: 'value',mapping:0}                   
						  ])
						)  
		    }); 
			
	var queryTypeData = [['0', '0'],['1', '1'],['2', '2'],['3', '3'],['4', '4'],['5', '5'],['6', '6'],['7', '7'],['8', '8'],['9', '9']];
        
	var btslevelStore = new Ext.data.SimpleStore({
		    fields: ['value', 'text'],
		    data : queryTypeData
		});		
			
	var btslevelCombo = new Ext.form.ComboBox({	   
		fieldLabel: '基站级别',
		name: 'btslevel',	
		width:200,
		valueField :"value",
	    displayField: "text",
	    mode: 'local',
		selectOnFocus:true,     
		disabled:true,		
		forceSelection: true,
		blankText:'请选基站级别',
		emptyText:'选择基站级别',
		hiddenName:'btslevel',
		triggerAction: 'all',
		allowBlank:false,
		editable:false, 
		store: btslevelStore,
		value:-1
	}); 
	
	var netGradeStore  = new Ext.data.Store({  
		        proxy:new Ext.data.DWRProxy(JCommWeb.getDirctoryByType,{}),  
		        reader:new Ext.data.DWRArrayReader(
						{},
						new Ext.data.Record.create([  
							{name: 'text', mapping:1},       
							{name: 'value',mapping:0}                   
						  ])
						)  
		    }); 
	
	var netGradeCombo = new Ext.form.ComboBox({	   
		fieldLabel: '网元级别',
		name: 'trannetgrade',	
		width:200,
		valueField :"value",
	    displayField: "text",
	    mode: 'remote',
		selectOnFocus:true,                    
		forceSelection: true,
		blankText:'网元级别',
		emptyText:'网元级别',
		disabled:true,
		hiddenName:'trannetgrade',
		triggerAction: 'all',
		//allowBlank:false,
		editable:false, 
		store: netGradeStore
	});
	netGradeStore.on('beforeload', function() {
			  netGradeStore.baseParams = {
					DIRECTORY_TYPE:'30'   
			  };
		});	
	netGradeStore.load({params:{DIRECTORY_TYPE:'30'}});
	
	var btskindStore  = new Ext.data.Store({  
		        proxy:new Ext.data.DWRProxy(JCommWeb.getDirctoryByType,{}),  
		        reader:new Ext.data.DWRArrayReader(
						{},
						new Ext.data.Record.create([  
							{name: 'text', mapping:1},       
							{name: 'value',mapping:0}                   
						  ])
						)  
		    }); 
	
	var btskindCombo = new Ext.form.ComboBox({	   
		fieldLabel: '基站性质',
		name: 'btskind',	
		width:200,
		valueField :"value",
	    displayField: "text",
	    mode: 'remote',
		selectOnFocus:true,                    
		forceSelection: true,
		disabled:true,
		blankText:'基站性质',
		emptyText:'基站性质',
		hiddenName:'btskind',
		triggerAction: 'all',
		editable:false, 
		store: btskindStore
	});
	btskindStore.on('beforeload', function() {
			  btskindStore.baseParams = {
					DIRECTORY_TYPE:'31'   
			  };
		});	
	//btskindStore.load({params:{DIRECTORY_TYPE:'31'}});
	var btstypeStore  = new Ext.data.Store({  
		        proxy:new Ext.data.DWRProxy(JCommWeb.getDirctoryByType,{}),  
		        reader:new Ext.data.DWRArrayReader(
						{},
						new Ext.data.Record.create([  
							{name: 'text', mapping:1},       
							{name: 'value',mapping:0}                   
						  ])
						)  
		    });
	var btstypeCombo = new Ext.form.ComboBox({	   
		fieldLabel: '基站类型',
		name: 'btstype',	
		width:200,
		valueField :"value",
	    displayField: "text",
	    mode: 'remote',
		selectOnFocus:true,                    
		forceSelection: true,
		blankText:'基站类型',
		emptyText:'基站类型',
		disabled:true,
		hiddenName:'btstype',
		triggerAction: 'all',
		editable:false, 
		store: btstypeStore
	});
	btstypeStore.on('beforeload', function() {
			  btstypeStore.baseParams = {
					DIRECTORY_TYPE:'19'   
			  };
		});	
	var coverageStore  = new Ext.data.Store({  
		        proxy:new Ext.data.DWRProxy(JCommWeb.getDirctoryByType,{}),  
		        reader:new Ext.data.DWRArrayReader(
						{},
						new Ext.data.Record.create([  
							{name: 'text', mapping:1},       
							{name: 'value',mapping:0}                   
						  ])
						)  
		    });
	var coverageCombo = new Ext.form.ComboBox({	   
		fieldLabel: '覆盖区域',
		name: 'coverage',	
		width:200,
		valueField :"value",
	    displayField: "text",
	    mode: 'remote',
		selectOnFocus:true,                    
		forceSelection: true,
		blankText:'覆盖区域',
		emptyText:'覆盖区域',
		disabled:true,
		hiddenName:'coverage',
		triggerAction: 'all',
		editable:false, 
		store: coverageStore
	});
	coverageStore.on('beforeload', function() {
			  coverageStore.baseParams = {
					DIRECTORY_TYPE:'32'   
			  };
		});	
	
	var maintypeStore  = new Ext.data.Store({  
		        proxy:new Ext.data.DWRProxy(JCommWeb.getDirctoryByType,{}),  
		        reader:new Ext.data.DWRArrayReader(
						{},
						new Ext.data.Record.create([  
							{name: 'text', mapping:1},       
							{name: 'value',mapping:0}                   
						  ])
						)  
		    });
	var maintypeCombo = new Ext.form.ComboBox({	   
		fieldLabel: '维护方式',
		name: 'maintype',	
		width:200,
		valueField :"value",
	    displayField: "text",
	    mode: 'remote',
		selectOnFocus:true,                    
		forceSelection: true,
		disabled:true,
		blankText:'维护方式',
		emptyText:'维护方式',
		hiddenName:'maintype',
		triggerAction: 'all',
		editable:false, 
		store: maintypeStore
	});
	maintypeStore.on('beforeload', function() {
			  maintypeStore.baseParams = {
					DIRECTORY_TYPE:'17'   
			  };
		});	
	
	
	
	var cType = Ext.data.Record.create([								
							   {name: 'id', type: "string"},
							   {name: 'btscode', type: "string"}, 
							   {name: 'other', type: "string"}, 
							   {name: 'btsCodeNo',  type: 'string'}
						 ]); 
	var cSM = new Ext.grid.CheckboxSelectionModel({singleSelect: true});						
	var cCM = new Ext.grid.ColumnModel(
			[    
				//{header: "id", width: 50,dataIndex: 'id',align:'left'},
				cSM, 	
				{header: "编号", width: 130, dataIndex: 'other',align:'left'},	
				{header: "基站编号", width: 100, dataIndex: 'btsCodeNo',align:'left',editor: new Ext.form.TextField({allowBlank: false})}				
			]
		);				 
	
	function showCDelete(id)
	{
		//return "<input type='button' value='删除' class='x-btn button' onclick='doStorageBatteryDelete(\"" + id  +   "\")'>";  
	}
	var cDS = new Ext.data.Store({
				proxy: new Ext.data.DWRProxy(JGeographicalenvWeb.getNoList, true),	
				reader: new Ext.data.ListRangeReader({
					totalProperty: 'totalSize',
					id: 'id'
				}, cType),
				sortInfo:{field:'id', direction:'ASC'}// 排序信息
			});
		 
	var cGrid = new Ext.grid.EditorGridPanel({			 	
			ds: cDS,
			cm: cCM, 
			autoWidth : true,  
			autoScroll : true,  
			autoHeight　: false,
			region : 'center',
			width:200,
			height: 250,
			minSize: 200,		
			frame:true,
			clicksToEdit:2,
			sm: cSM,
			tbar: [
				{
					text: '添加',
					iconCls: 'silk-add',
					handler: onAdd
				}, 
				'-', 
				{
					text: '删除',
					iconCls: 'silk-delete',
					handler: onDelete
				}, 
				'-'
			],
				
			bbar: new Ext.PagingToolbar({
					pageSize: 17,
					store: cDS,
					displayInfo: true,
					displayMsg: '一共 {2} 条',
					emptyMsg: "没有记录"
				})
		});

	function len(s) { 
		var l = 0; 
		var a = s.split(""); 
		for (var i=0;i<a.length;i++) { 
			if (a[i].charCodeAt(0)<299) { 
				l++; 
			} else { 
				l+=2; 
			} 
		} 
		return l; 
	} 	
		
	// 单元格编辑后事件处理
	cGrid.on("afteredit", afterEdit, cGrid);
	// 事件处理函数
	function afterEdit(e) {
		var record = e.record;
        var GeograpNoBO = {};
		var btsCodeNo = record.get("btsCodeNo");
		if(len(btsCodeNo)>12)
		{
			Ext.Msg.show({
                title: '提示',
                msg: '基站编号的长度不能大于12。',
                modal: false,
                icon: Ext.Msg.WARNING,
                buttons: Ext.Msg.OK
            });
			record.set(e.field, e.originalValue);
			return false;
		}
		
		GeograpNoBO.id = record.get("id");
		GeograpNoBO.btscode = btsFirstNo;
		GeograpNoBO.other = record.get("other");
		GeograpNoBO.btsCodeNo = btsCodeNo;
		JGeographicalenvWeb.saveGeographicalenvNoBo(GeograpNoBO,function(data){
  	     	loadBtsCodeDate(cDS);
        });
	};
		
		
	/**
     * onAdd
     */
    function onAdd(btn, ev) {        
		var Plant = cGrid.getStore().recordType;	
		var TotalCount = cGrid.getStore().getTotalCount()+1;
		var p = new Plant({
                    //id : '',
					btscode : "基站编号"+TotalCount,
					btsCodeNo : ""
                });

		cGrid.stopEditing();	
        cGrid.store.insert(0, p);      
		cGrid.startEditing(0, 0);
		
		
		var GeograpNoBO = {};// 
		GeograpNoBO.btscode = btsFirstNo;
		GeograpNoBO.btsCodeNo = "";
		GeograpNoBO.other = "基站编号"+TotalCount;
		JGeographicalenvWeb.saveGeographicalenvNoBo(GeograpNoBO,function(data){
  	     	loadBtsCodeDate(cDS);
        });
		
		
    }
    /**
     * onDelete
     */
    function onDelete() {
        var rec = cGrid.getSelectionModel().getSelected();
        if (!rec) {
			Ext.Msg.show({
                title: '提示',
                msg: '请选择需要删除的基站编号后，再点击删除按钮。',
                modal: false,
                icon: Ext.Msg.WARNING,
                buttons: Ext.Msg.OK
            });

            return false;
        }      
		var GeograpNoBO = {};
		GeograpNoBO.id = rec.get("id");		
		JGeographicalenvWeb.deleteGeographicalenvNoBo(GeograpNoBO,function(data){
  	     	loadBtsCodeDate(cDS);
			cGrid.store.remove(rec);
        });
    }
	
	
	//选择父节点弹出窗口
	var win = new Ext.Window({
					//el:'hello-win',
					layout:'fit',
					width:350,
					height:300,
					closeAction:'hide',
					plain: true,
					modal:true,
					items:cGrid,		
					buttons: [
						{
							text:'确&nbsp;&nbsp;定',
							handler: function()
							{								 
								win.hide();
							}
						}]
				});	
	var btsCodeButton = new Ext.Button({
						pressed : true,
	                    enableToggle : true,
	                    text : '其他编号',
	                    toggleHandler:doShow
			});
		
		
	function doShow()
	{	        
		win.show();	
		loadBtsCodeDate(cDS);			
	}
	
	
	geographicalenvPanel = new Ext.form.FormPanel({
		region     : 'center', 
		bodyStyle  : 'padding: 10px; background-color: #DFE8F6',
		labelWidth : 130,  
		height: 180,
		minSize: 200,
		maxSize: 200,
		frame:true,
		buttonAlign:'right',
		layout:'column', 
		items:[
			 {
				columnWidth:.33,
				layout: 'form',  
				labelWidth:100,	 
				labelAlign:'right',		
				items: [
					{
						xtype:'textfield',
						readOnly: true,
						fieldLabel:'基站编号',
						value:'<%=strbtscode%>',
						width:200,
						disabled:true,
						itemCls:'win-first', //向左边浮动,处理控件横排   
						clearCls:'allow-float', //允许两边浮动,在实际生成的HTML结构中有专门的DIV阻断浮动  
						name: 'btscode'
					},  
					landformCombo
					, {
						xtype:'textfield',
						fieldLabel: '基站搬迁记录',
						width:200,
						disabled:true,
						name: 'relocationrd'
					}, {
						xtype:'hidden',
						fieldLabel: '维护人',
						width:200,
						disabled:true,
						name: 'username'
					}, {
						xtype:'numberfield',
						fieldLabel: '有效工作半径（米）',
						width:200,
						value:-1,
						disabled:true,
						name: 'workingradius'
					}, {
						xtype:'textfield',
						fieldLabel: '传输网元ID',
						width:200,
						disabled:true,
						name: 'trannetid'
					}, {
						xtype:'textfield',
						fieldLabel: '传输网元名称',
						width:200,
						disabled:true,
						name: 'trannetname'
					},
					netGradeCombo
					
					]
			 },
			 {
				columnWidth:.33,
				layout: 'form',  
				labelWidth:80,	
				labelAlign:'right',				
				items: [
					{
						xtype:'textfield',
						fieldLabel: '基站名称',
						readOnly: true,
						width:200,
						disabled:true,
						value:'<%=strbtsname%>',
						name: 'btsname'
					}, {
						xtype:'numberfield',
						decimalPrecision:6,
						fieldLabel: '经度',
						width:200,
						disabled:true,
						name: 'lng'
					}, {
						xtype:'textfield',
						fieldLabel: '基站详细地址',
						width:200,
						disabled:true,
						name: 'graphDeatilAddr'
					},{
						xtype:'datefield',
						fieldLabel: '入网时间',
						format : "Y-m-d",
						width:200,
						disabled:true,
						allowBlank:false,
						name: 'registtime'
					}, 
					 btskindCombo
					,btstypeCombo
					,
					{
						xtype:'textarea',
						fieldLabel: '备注',
						width:200,
						disabled:true,
						name: 'memo'
					}]
			 },
			 {
				columnWidth:.34,
				layout: 'form',  
				labelWidth:80,	 
				labelAlign:'right',		
				items: [
					btszoneCombo, 
					{
						xtype:'numberfield',
						decimalPrecision:6,
						fieldLabel: '纬度',
						width:200,
						disabled:true,
						allowBlank:false,
						name: 'lat'
					}, 
					distcodeCombo
					,
					{
						xtype:'numberfield',
						fieldLabel: '海拨高度(米)',
						width:200,
						value:-1,
						disabled:true,
						name: 'graphHigh'
					},btslevelCombo
					,coverageCombo
					,maintypeCombo
					]
			 }
			] 	
	});
	var mainDIV = Ext.get("mainTabPanelDIV");
	var displayPanel = new Ext.Panel({
			width    : mainDIV.getComputedWidth(),
			height   : 500,
			layout   : 'border',
			renderTo : 'GeographicalenvTab',
			items    : geographicalenvPanel 
		});
	 
 

	
	
	function saveGeographicalenv()
	{
		if (!geographicalenvPanel.getForm().isValid())
			return;	
			
		var form = geographicalenvPanel.getForm().getValues(false);	
		GeographicalenvBo = {};
		GeographicalenvBo.btscode = form.btscode;
		GeographicalenvBo.btsname = form.btsname;
		GeographicalenvBo.btszone = form.btszone;
		GeographicalenvBo.landform = form.landform;
		GeographicalenvBo.lng = form.lng;
		GeographicalenvBo.lat = form.lat;
		GeographicalenvBo.relocationrd = form.relocationrd;
		GeographicalenvBo.username = form.username;
		GeographicalenvBo.distcode = form.distcode;
		GeographicalenvBo.btslevel = form.btslevel;
		GeographicalenvBo.workingradius = form.workingradius;
		GeographicalenvBo.graphHigh = form.graphHigh;
		GeographicalenvBo.memo = form.memo;
		GeographicalenvBo.graphDeatilAddr = form.graphDeatilAddr;
		
		
		GeographicalenvBo.trannetid = form.trannetid;
		GeographicalenvBo.trannetname = form.trannetname;
		GeographicalenvBo.trannetgrade = form.trannetgrade;
		GeographicalenvBo.btskind = form.btskind;
		GeographicalenvBo.btstype = form.btstype;
		GeographicalenvBo.coverage = form.coverage;
		GeographicalenvBo.maintype = form.maintype;
		
		var registtimeDate = new Date();	
		var arrPlanTime = form.registtime.split("-");		
				
		var yearOth = arrPlanTime[0];
		var monthOth = arrPlanTime[1];
		var dayOth = arrPlanTime[2];
		registtimeDate.setFullYear(yearOth,monthOth-1,dayOth);
		
		GeographicalenvBo.registtime = registtimeDate;
		
		JGeographicalenvWeb.updateGeographicalenv(GeographicalenvBo,function(data)
		{
			if(data)
			{ 
				Ext.Msg.alert('成功',"操作成功！"); 				 
			}else
			{
				Ext.Msg.alert("失败","操作失败!");
			}
		})
		
		
	}
	
	
	
	
})	


</script>
</body>
</html>   